/*
 * @Description: 搜索控制器
 * @Author: iamsmiling
 * @Date: 2021-06-09 14:53:04
 * @LastEditTime: 2021-06-09 15:39:01
 */
import 'package:get/get.dart';

enum SearchType { all, label, sourceProvider, sourceDemander }

extension SearchTypeKit on SearchType {
  String get name =>
      {
        SearchType.all: "全部",
        SearchType.label: "标题标签",
        SearchType.sourceProvider: "提供资源",
        SearchType.sourceDemander: "需求资源"
      }[this] ??
      "";
}

class SearchController extends GetxController {
  SearchType searchType = SearchType.all;

  select(bool? flag, SearchType type) {
    if (flag == true) {
      searchType = type;
    }
    update();
  }

  List<String> searchHistory = ["信用卡", "直播带货", "主播", "企业通讯", "美妆博主"];

  delete(String s) {
    searchHistory.remove(s);
    update();
  }
}
